import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class Test {
    public static void main(String[] args)  throws Exception{
        int bufSize = 1024;
        byte[] bs = new byte[bufSize];
        ByteBuffer byteBuf = ByteBuffer.allocate(1024);
        FileChannel channel = new RandomAccessFile("F:\\ComputeDb\\XUANZE\\PROD.XPA.ATSN.MAN.MESSAGECHECKER.EQUIPMENTSTATECHANGE.PUB.V1","r").getChannel();
        while(channel.read(byteBuf) != -1) {
            int size = byteBuf.position();
            byteBuf.rewind();
            byteBuf.get(bs);
            // 把文件当字符串处理，直接打印做为一个例子。
//            System.out.print(new String(bs, 0, size));
            //处理
            String str = new String(bs, 0, size);
            System.out.print(str);
        }
    }
}
